﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SupermarketSalesModel;
using System.Data.SqlClient;
using SupermarketSalesController;

namespace pe.edu.pucp.lp2.sales.dao
{ 
    public abstract class DAOFactory
    {
        public const int MYSQL = 1;
        public const int SQLSERVER = 2;
        public const int XML = 3;

        public static DAOFactory getDAOFactory(int dbType)
        {
            DAOFactory factory = null;
            switch (dbType)
            {
                //case MYSQL: factory = new MySQLDAOFactory(); break;
                case SQLSERVER: factory = new SQLServerDAOFactory(); break;
                //case XML: factory = new XMLDAOFactory(); break;
            }
            return factory;
        }

        public abstract DAOProduct getDAOProduct();
        public abstract DAOCNDetail getDAOCNDetail();
        public abstract DAOSale getDAOSale();
        public abstract DAOCashRegister getDAOCashRegister();
        public abstract DAOCreditNote getDAOCreditNote();
        public abstract DAOSalesclerk getDAOSalesclerk();
        public abstract DAOPromotion getDAOPromotion();
        public abstract DAOProductxPromotion getDAOProductxPromotion();
        public abstract DAOClient getDAOClient();

    }

    public class SQLServerDAOFactory : DAOFactory
    {

        public override DAOProduct getDAOProduct()
        {
            return new SQLServerDAOProduct();
        }

        public override DAOCNDetail getDAOCNDetail()
        {
            return new SQLServerDAOCNDetail();
        }

        public override DAOSale getDAOSale()
        {
            return new SQLServerDAOSale();
        }

        public override DAOCashRegister getDAOCashRegister()
        {
            return new SQLServerDAOCashRegister();
        }

        public override DAOSalesclerk getDAOSalesclerk()
        {
            return new SQLServerDAOSalesclerk();
        }

        public override DAOPromotion getDAOPromotion()
        {
            return new SQLServerDAOPromotion();
        }

        public override DAOProductxPromotion getDAOProductxPromotion()
        {
            return new SQLServerDAOProductxPromotion();
        }

        public override DAOCreditNote getDAOCreditNote()
        {
            return new SQLServerDAOCreditNote();
        }

        public override DAOClient getDAOClient()
        {
            return new SQLServerDAOClient();
        }

        
    }


    
}
